#ifndef SINGLETON_H
#define SINGLETON_H

template<typename T>
class Singleton{
	public:
		static T& Instance(){
			if(instance==0){
				instance=new Singleton<T>();
			}
			return instance->t;
		}
	protected:
		Singleton(){}
		Singleton(const Singleton<T>&){}
		Singleton<T> operator=(const Singleton<T>&){return *this;}
	private:
		static Singleton<T>* instance;
		T t;
};
template<typename T>			
Singleton<T>* Singleton<T>::instance=0;

#endif
